function GM:ScalePlayerDamage (pl, hitgroup, dmginfo)
	pl.lastDamage = pl.lastDamage or {}
	if pl.lastDamage[1] == dmginfo:GetAttacker() and pl.lastDamage[2] == dmginfo:GetDamagePosition() then return end
	local bDamage = dmginfo:GetDamage()
	--print ("damage: "..dmginfo:GetDamage())
	if dmginfo:IsExplosionDamage() then
		dmginfo:ScaleDamage (0.4) --so grenades don't rule the world
	end
	--print ("new damage: "..dmginfo:GetDamage())
	dmginfo:AddDamage (-bDamage)
	--print ("newnew damage: "..dmginfo:GetDamage())
	pl.lastDamage = {dmginfo:GetAttacker(), dmginfo:GetDamagePosition()}
	return dmginfo
end

function GM:PlayerShouldTakeDamage (pl, att)
	if !self:IsBuild() and not att:IsPlayer() then return true end
end

function GM:RestorePlayerHealth ()
	for k,v in pairs (player.GetAll()) do
		v:SetHealth (100)
	end
end

GM:AddHook( "RoundChanged", "RestorePlayerHealth" )

function GM:DoPlayerDeath ( ply )
	ply:CreateRagdoll()
 	ply:AddDeaths (1) 
end

function GM:PlayerDeath ()
	
end

local disallowedModels = {["models/player/police.mdl"] = true,
	["models/player/combine_soldier_prisonguard.mdl"] = true,
	["models/player/combine_soldier.mdl"] = true,
	["models/player/combine_super_soldier.mdl"] = true,
	["models/player/kleiner.mdl"] = true
}
	
local replacementModels = {
	"models/player/Group03/Female_01.mdl",
	"models/player/Group03/Female_02.mdl",
	"models/player/Group03/Female_03.mdl",
	"models/player/Group03/Female_04.mdl",
	"models/player/Group03/Female_06.mdl",
	"models/player/Group03/Female_07.mdl",
	"models/player/Group03/Male_01.mdl",
	"models/player/Group03/Male_02.mdl",
	"models/player/Group03/Male_03.mdl",
	"models/player/Group03/Male_04.mdl",
	"models/player/Group03/Male_05.mdl",
	"models/player/Group03/Male_06.mdl",
	"models/player/Group03/Male_07.mdl",
	"models/player/Group03/Male_08.mdl",
	"models/player/Group03/Male_09.mdl",
}

function GM:PlayerSetModel (pl)
 	local cl_playermodel = pl:GetInfo ("cl_playermodel")
 	local modelname = player_manager.TranslatePlayerModel (cl_playermodel)
	print (modelname)
	if disallowedModels[string.lower (modelname)] then
		modelname = replacementModels[math.random(#replacementModels)]
	end
 	util.PrecacheModel (modelname) 
 	pl:SetModel (modelname) 
end
